#Call the ACS API, returns a sf object
mn_median_value.df <- get_acs(
geography = "cbg",
variables = "B25077_001",
state = "MN",
county = "Hennepin",
year = 2020,
geometry = TRUE
)
|
| | 0%
|
| | 1%
|
|= | 1%
|
|= | 2%
|
|== | 2%
|
|== | 3%
|
|== | 4%
|
|=== | 4%
|
|=== | 5%
|
|==== | 5%
|
|==== | 6%
|
|===== | 7%
|
|===== | 8%
|
|====== | 8%
|
|====== | 9%
|
|======= | 9%
|
|======= | 10%
|
|======= | 11%
|
|======== | 11%
|
|======== | 12%
|
|========= | 12%
|
|========= | 13%
|
|========== | 14%
|
|========== | 15%
|
|=========== | 15%
|
|=========== | 16%
|
|============ | 17%
|
|============= | 18%
|
|============= | 19%
|
|============== | 20%
|
|=============== | 21%
|
|=============== | 22%
|
|================ | 22%
|
|================ | 23%
|
|================= | 24%
|
|================== | 25%
|
|================== | 26%
|
|=================== | 27%
|
|==================== | 28%
|
|==================== | 29%
|
|===================== | 30%
|
|====================== | 31%
|
|======================= | 33%
|
|======================== | 34%
|
|======================== | 35%
|
|========================= | 36%
|
|========================== | 37%
|
|========================== | 38%
|
|=========================== | 38%
|
|============================ | 40%
|
|============================ | 41%
|
|============================= | 42%
|
|============================== | 43%
|
|================================ | 46%
|
|================================= | 48%
|
|================================== | 49%
|
|==================================== | 51%
|
|===================================== | 53%
|
|====================================== | 54%
|
|======================================= | 56%
|
|======================================== | 58%
|
|========================================== | 60%
|
|=========================================== | 61%
|
|=========================================== | 62%
|
|============================================ | 63%
|
|=============================================== | 67%
|
|================================================ | 68%
|
|================================================ | 69%
|
|================================================= | 70%
|
|================================================== | 71%
|
|================================================== | 72%
|
|==================================================== | 74%
|
|===================================================== | 75%
|
|====================================================== | 77%
|
|======================================================= | 78%
|
|=========================================================== | 85%
|
|============================================================ | 85%
|
|============================================================== | 88%
|
|============================================================== | 89%
|
|================================================================ | 92%
|
|================================================================== | 94%
|
|=================================================================== | 95%
|
|===================================================================== | 99%
|
|======================================================================| 100%
#Add text label
mn_label.df <- mn_median_value.df %>%
mutate(
cbg = str_split(NAME,",")%>%
map_chr(1)%>%str_remove("Census Tract "),
text_label = str_c("cbg",cbg,
"\nMedianValue - " ,
scales::dollar(estimate)
)
)
value <- ggplot() +
geom_sf(data = mn_label.df,
aes(fill = estimate, text = text_label),
colour = "black", size = 0.02) +
scale_fill_viridis_c("Median Value", labels = scales::dollar) +
theme_void() +
theme(legend.position = "right")+
labs(title="Median House Value in Hennepin County in 2020")
ggplotly(value, tooltip = "text") %>%
style(hoveron = "fills")